import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class demo {
    public static void main(String[] args) {
        Map<String, String> map = new HashMap<>();
        map.put("苹果","apple");
        map.put("香蕉","banana");
        map.put("梨","pear");
        System.out.println(map);
//        Set<String> keySet = map.keySet();  //使用keySet()方法 遍历
//        for (String key: keySet) {
//            System.out.println(key + map.get(key));
//        }

//        Set<Map.Entry<String, String>> entrySet = map.entrySet();
//        for (Map.Entry<String, String> entry: entrySet) {  //for-each遍历
//            System.out.println(entry);
//        }
//        System.out.println(map.containsKey("苹果"));
//        System.out.println(map.containsValue("pear"));
//        System.out.println(map.containsValue("melon"));

        System.out.println(map.isEmpty());
        map.clear();
        System.out.println(map.isEmpty());
    }
}
